#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <stack>
#include <bitset>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
struct node
{
	int lastv;
	int fa;
	int nxt[30];
	int cnt;
}tr[2500010];
int idx=1;
int adr[50010];
int main()
{
	IOS;
	int n;
	cin>>n;
	string s;
	for(int i=1;i<=n;i++)
	{
		int t=1;
		cin>>s;
		for(auto it:s)
		{
			int num=0;
			if(it>='a' && it<='z') num=it-'a';
			else if(it=='.') num=26;
			else if(it=='/') num=27;
			
			if(tr[t].nxt[num]==0)
			{
				tr[t].nxt[num]=idx++;
				tr[idx].fa=t;
			}
			t=tr[t].nxt[num];
			tr[t].lastv=i;
		}
		adr[i]=t;
	}
	int ans=0;
	int cnt=0;
	for(int i=1,j=0;i<=n;i++)
	{
		cnt=0;
		for( j=adr[i];tr[tr[j].fa].lastv==i;j=tr[j].fa)
		{
			cnt+=tr[j].cnt;
//			cout<<j<<endl;
		}
		cnt+=tr[j].cnt;
	    tr[tr[j].fa].cnt++;
	    ans+=1-cnt;
	    cout<<ans<<'\n';
	}

	return 0;
}

